#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/eeprom.h>
EEMEM uint16_t ee_zn, ee_zns; //*    2   EEPROM
volatile char pwm_counter,my_y,button1, button = 0;

//   int0
ISR(SIG_INTERRUPT0)
{_delay_us(50);
if((PIND & (1 << PD2))==0)
{_delay_us(50);
if((PIND & (1 << PD0))==0)
}
GIFR = (1< 63) 
{
PORTB = 0x00;
pwm_counter = 0;
}
if (pwm_counter > my_y) PORTB |= (1 << PB0);
}



//  
 
int main (void)
{
DDRB |= (1 << PB0); // 
PORTB = 0x00;
DDRD |= (0 << PD3)|(0 << PD2)|(0 << PD1)|(0 << PD0); // 
PORTD |= (1 << PD2)|(1 << PD1)|(1 << PD0)|(1 << PD3); //   
TIMSK |= (1 << TOIE0); //    0
TCCR0 |= (1 << CS00); 
 
MCUCR |= (0 << ISC00)|(1 << ISC01); //     INT0(  )
 
GIFR |= (1 << INTF0);     //    
GICR |= (1 << INT0);      //    INT0
sei(); //  

while(1) //  

{
my_y = eeprom_read_byte(&ee_zn); //    EEPROM
my_y--; 
my_y++;

if((PIND & (1 << PD1))==0) //    
{
while((PIND & (1 << PD1))==0){} //    
eeprom_write_byte(&eeprom_var, ee_zn ); //  1   EEPROM;

}

while(2) ((PIND & (1 << PD3))==0) //    
{
my_y = eeprom_read_byte(&ee_zns); //  2   EEPROM
{  my_y--; if(my_y < 1) my_y = 1;}
 
else
 
{ my_y++; }

if((PIND & (1 << PD1))==0) //    
{
while((PIND & (1 << PD1))==0){} //    
eeprom_write_byte(&eeprom_var, ee_zns ); //  2   EEPROM;
 
}
}